package org.watchrecords.dbo;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;

import org.watchrecords.constants.District;

@Entity
@NamedQueries({
    @NamedQuery(name = "getIncidents", query = "SELECT i FROM Incident i ORDER BY i.date DESC")
    })
public class Incident implements Identifiable {
    /**
     * 
     */
    private static final long serialVersionUID = -7272544869164279384L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;
    private District district;
    private String location;
    private Date date;
    private Date created;
    private String watchman;
    private String crime;
    private String victim;
    private String witnesses;
    private String punishment;

    @Column(length = 2000)
    private String description;
    
    @ManyToMany(fetch = FetchType.LAZY)
    private List<Offender> offenders = new ArrayList<Offender>();

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public District getDistrict() {
        return district;
    }

    public void setDistrict(District district) {
        this.district = district;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public String getLocation() {
        return location;
    }

    public void setLocation(String location) {
        this.location = location;
    }

    public List<Offender> getOffenders() {
        return offenders;
    }

    public void setOffenders(List<Offender> offenders) {
        this.offenders = offenders;
    }

    public String getCrime() {
        return crime;
    }

    public void setCrime(String crime) {
        this.crime = crime;
    }

    public String getVictim() {
        return victim;
    }

    public void setVictim(String victim) {
        this.victim = victim;
    }

    public String getWitnesses() {
        return witnesses;
    }

    public void setWitnesses(String witnesses) {
        this.witnesses = witnesses;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Date getCreated() {
        return created;
    }

    public void setCreated(Date created) {
        this.created = created;
    }

    public String getWatchman() {
        return watchman;
    }

    public void setWatchman(String watchman) {
        this.watchman = watchman;
    }

    public String getPunishment() {
        return punishment;
    }

    public void setPunishment(String punishment) {
        this.punishment = punishment;
    }
}
